<!--
 * @Description: 查看
 * @Author: Liu Zhiwang
 * @Date: 2021-06-08 16:18:15
 * @LastEditTime: 2021-06-08 19:29:46
 * @LastEditors: Liu Zhiwang
-->
<template>
  <div>
    <base-dialog
      class="dialog_box dialog-look"
      width="60%"
      :visible.sync="dialogLook.visible"
      :title="dialog.title"
      :loading="dialog.loading"
      :disabled="dialog.disabled"
      :show-default-footer="false"
      @updateData="updateData"
      @open="beforeOpenDialog">
      <el-form
        ref="dataForm"
        :model="dialog.form"
        :rules="dialog.rules"
        :disabled="dialog.disabled"
        label-width="100px">
        <table id="customers">
          <tr>
            <td>使用单位</td>
            <td>{{ dialog.form.deptName }}</td>
            <td>设备分类名称</td>
            <td>{{ dialog.form.typeName }}</td>
            <td>设备名称</td>
            <td>{{ dialog.form.divceName }}</td>
          </tr>
          <tr>
            <td>设备型号</td>
            <td>{{ dialog.form.divceType }}</td>
            <td>设备编号</td>
            <td>{{ dialog.form.divceNumber }}</td>
            <td>设备状态</td>
            <td>{{ dialog.form.state }}</td>
          </tr>
          <tr>
            <td>固组单位</td>
            <td>{{ dialog.form.divceTypeName }}</td>
            <td>投运日期</td>
            <td>{{ dialog.form.divceDate }}</td>
            <td>设备寿命</td>
            <td>{{ dialog.form.divceAge }}</td>
          </tr>
          <tr>
            <td>设备厂家</td>
            <td>{{ dialog.form.producerName }}</td>
            <td>设备厂家联系人</td>
            <td>{{ dialog.form.contacts }}</td>
            <td>设备联系人电话</td>
            <td>{{ dialog.form.contactsPhone }}</td>
          </tr>
          <tr>
            <td>安装车号</td>
            <td>{{ dialog.form.carId }}</td>
            <td>设备编码</td>
            <td>{{ dialog.form.eqtNumber }}</td>
          </tr>
          <!-- <tr>
             <td>是否系统</td>
             <td>{{ dialog.form.isSystem?'是':'否' }}</td>
             <td>是否公用</td>
             <td>{{ dialog.form.isPub?'是':'否' }}</td>
           </tr>
           <tr>
             <td>状态</td>
             <td>{{ dialog.form.status?'启用':'禁用' }}</td>
             <td />
             <td />
           </tr>-->
          <tr rowspan="2">
            <td>备注</td>
            <td colspan="5" style="height:150px">{{ dialog.form.remark }}</td>
          </tr>
        </table>
      </el-form>
    </base-dialog>
  </div>
</template>
<script>
export default {
  components: {},
  props: {
    dialog: {
      type: Object,
      default() {
        return {}
      }
    },
    dialogLook: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
    }
  },
  watch: {
    'dialogLook.visible'() {
      if (this.dialogLook.visible) {
        this.getList()
      }
    }
  },
  methods: {
    // 获取下拉数据、字典
    getList() {},

    // 回调方法
    updateData() {
      this.$refs.dataForm.validate((valid) => {
        if (valid) {
          this.dialog.loading = true
          this.$emit('updateData', this.dialog.form)
        }
      })
    },

    // 初始化
    beforeOpenDialog() {
      this.$nextTick(() => {
        this.$refs.dataForm.clearValidate()
      })
    }
  }
}
</script>
<style lang="scss">
  .dialog-look {
    .el-dialog__body {
      height: calc(80vh - 1px);
      .base-table {
        height: 470px!important;
      }
    }
  }
  #customers {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
  }
  #customers td, #customers th {
    border: 1px solid #DFE6EC;
    font-size: 16px;
    line-height: 1.5;
    padding: 8px 0;
  }
  #customers tr td:nth-child(odd){
    width: 120px;
    white-space: nowrap;
    padding-left: 20px;
    padding-right: 26px;
    text-align: right;
    background: #E9F2FC;
  }
  #customers tr td:nth-child(even){
    padding-left: 20px;
    padding-right: 20px;
  }
  .dialog_box #customers tr td.file-box {
    width: 100%;
    text-align: left;
    background: #ffffff;
  }
  #customers .file-content {
    min-height: 187px;
  }
</style>
